<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

class NewsController extends Controller {

    /**
     * Declares class-based actions.
     */
    public function actions() {
        return array(
            // captcha action renders the CAPTCHA image displayed on the contact page
            'captcha' => array(
                'class' => 'CCaptchaAction',
                'backColor' => 0xFFFFFF,
            ),
            // page action renders "static" pages stored under 'protected/views/site/pages'
            // They can be accessed via: index.php?r=site/page&view=FileName
            'page' => array(
                'class' => 'CViewAction',
            ),
        );
    }

    public function actionDetail($url) {

        $model = Posts::model()->findByPk((int) $url);
        if ($model == NULL) {
            $this->render('error');
        }
        
        $this->pageTitle = $model->title.' | ' . Yii::app()->name;
        $this->render('detail', array(
            'model' => $model
        ));
    }

}
